package com.example.demo.service.Impl;

import com.example.demo.mapper.LoginMapper;
import com.example.demo.service.ILoginService;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
@NoArgsConstructor

public class LoginServiceImpl implements ILoginService {

    @Autowired
    LoginMapper loginMapper;

    @Override
    public Integer login(String tel,String pwd) {
        Integer res=loginMapper.getId(tel,pwd);
        System.out.println(res);
        if(res==null) return -1;
        return res;
    }

//    @Override
//    public boolean register(Map<String,Object> map) {
//        loginMapper.update()
//    }

    @Override
    public boolean checkUsername(String username) {
        Integer res=loginMapper.checkUsername(username);
        return res != null;
    }//如果返回值为 true，说明用户已经存在
}
